package com.ltkj.baseplatform.controller;

import com.ltkj.baseplatform.domain.ArtCollection;
import com.ltkj.baseplatform.domain.SimpleValue;
import com.ltkj.baseplatform.domain.bo.ArtCollectionQueryBo;
import com.ltkj.baseplatform.service.IArtCollectionService;
import com.ltkj.common.core.web.controller.BaseController;
import com.ltkj.common.core.web.domain.AjaxResult;
import com.ltkj.common.core.web.page.TableDataInfo;
import com.ltkj.common.log.annotation.Log;
import com.ltkj.common.log.enums.BusinessType;
import com.ltkj.common.security.annotation.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 回收站Controller
 * 
 * @author liupf
 * @date 2023-08-28
 */
@RestController
@RequestMapping("/collection")
@Api(tags = "文章管理-回收站相关")
public class ArtCollectionController extends BaseController
{
    @Autowired
    private IArtCollectionService artCollectionService;

    /**
     * 查询回收站列表
     */
    @RequiresPermissions("baseplatform:collection:list")
    @GetMapping("/list")
    @ApiOperation("查询回收站列表")
    public TableDataInfo list(ArtCollectionQueryBo artCollectionQueryBo)
    {
        startPage();
        List<ArtCollection> list = artCollectionService.selectArtCollectionList(artCollectionQueryBo);
        return getDataTable(list);
    }
    /**
     * 删除回收站
     */
    @RequiresPermissions("baseplatform:collection:remove")
    @Log(title = "回收站", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("彻底删除回收站数据")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(artCollectionService.deleteArtCollectionByIds(ids));
    }
    /**
     * 还原回收站数据
     */
    @RequiresPermissions("baseplatform:collection:edit")
    @Log(title = "回收站", businessType = BusinessType.UPDATE)
    @PostMapping("/revert")
    @ApiOperation("还原回收站数据")
    public AjaxResult revert(@Validated @RequestBody SimpleValue.Ids ids)
    {
        return toAjax(artCollectionService.revert(ids.getIds(),artCollectionService.selectCollectionListByIds(ids.getIds())));
    }



    /**
     * 导出回收站列表
     */
    /*@RequiresPermissions("system:collection:export")
    @Log(title = "回收站", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @Operation(summary = "导出回收站数据", description = "导出回收站数据")
    public void export(HttpServletResponse response, ArtCollection artCollection)
    {
        List<ArtCollection> list = artCollectionService.selectArtCollectionList(artCollection);
        ExcelUtil<ArtCollection> util = new ExcelUtil<ArtCollection>(ArtCollection.class);
        util.exportExcel(response, list, "回收站数据");
    }*/

    /**
     * 获取回收站详细信息
     */
    /*@RequiresPermissions("system:collection:query")
    @GetMapping(value = "/{id}")
    @Operation(summary = "根据id查看回收站数据", description = "根据id查看回收站数据")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(artCollectionService.selectArtCollectionById(id));
    }*/

    /**
     * 新增回收站
     */
   /* @RequiresPermissions("system:collection:add")
    @Log(title = "回收站", businessType = BusinessType.INSERT)
    @PostMapping
    @Operation(summary = "新增回收站数据", description = "新增回收站数据")
    public AjaxResult add(@RequestBody ArtCollection artCollection)
    {
        return toAjax(artCollectionService.insertArtCollection(artCollection));
    }*/

    /**
     * 修改回收站
     */
   /* @RequiresPermissions("system:collection:edit")
    @Log(title = "回收站", businessType = BusinessType.UPDATE)
    @PutMapping
    @Operation(summary = "修改回收站数据", description = "修改回收站数据")
    public AjaxResult edit(@RequestBody ArtCollection artCollection)
    {
        return toAjax(artCollectionService.updateArtCollection(artCollection));
    }*/


}
